home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / tricordr.doc < prev    next >
Text File  |  1995-03-31  |  4KB  |  146 lines

  1. (Comp.sys.hp48) 
  2. Item: 2543 by sourada@iastate.edu [Steven D Ourada] 
  3. Subj: Tricorder simulator 
  4. Date: 31 Dec 1992 
  5.  
  6. [Note: This goofy program isn't really a tune or sound effect, but try 
  7.  it anyway.  This can be used to test the gullibility of the natives. 
  8.  Make up some outrageous story about what it's doing, and I'll bet you 
  9.  a nickle that most people will believe it!  -jkh-] 
  10.  
  11.  
  12.                Copyright 1992 Steven Ourada   Freeware 
  13.  
  14.                               TRICORDR 
  15.                               ======== 
  16.  
  17. What it is 
  18. ---------- 
  19.  
  20. This is a silly little program to simulate the 'Tricorder' devices used on 
  21. Star Trek. 
  22.  
  23.  
  24. How to use it 
  25. ------------- 
  26.  
  27. To use TRICORDR, download it into a convenient directory, take off the  
  28. plastic cover over the infra-red pair on your 48, and execute TRICORDR. 
  29. When you bring the front of the 48 close to some object, the speaker will  
  30. repeatedly beep. Wow, lot's of fun, eh? 
  31.  
  32. When the excitement dulls, press a key to get out of the program. 
  33.  
  34.  
  35. How it works 
  36. ------------ 
  37.  
  38. Nothing too complicated: a small assembly language code segment pulses 
  39. the IR emitter, and checks the detector to see if there is a 
  40. reflection. It reports this back to the user-RPL code that beeps if 
  41. there was a reflection. 
  42.  
  43. Don't be worried that this will drain your batteries; the IR LED is 
  44. only on for about 20 microseconds for each 10 milliseconds. 
  45.  
  46.  
  47. I disclaim it 
  48. ------------- 
  49.  
  50. This is Freeware, copy it freely as long as you give credit where it's due. 
  51. There is NO WARRANTY with this software as it is provided to you with no 
  52. charge. 
  53.  
  54.  
  55. That's it 
  56. --------- 
  57.  
  58. Keep in mind that this is my first attempt at using Saturn assembly and my 
  59. first HP48 program to be posted to Usenet. :-) If you have any comments, 
  60. please mail me.  
  61.  
  62. --------------- Cut here. Assembly source follows. ------------------ 
  63. ; Copyright 1992 Steven Ourada    Freeware 
  64.  
  65. ; Embedded assembly code to do "proximity check" 
  66. ; Turn the IR on, check to see if it reflected, turn it off 
  67.  
  68.  include class.mac 
  69.  
  70.  rpl $02dcc              ; DOCODE 
  71.  
  72. pgmbeg 
  73.  rpl pgmend-pgmbeg       ; length of code  
  74.  
  75.  jsr save_regs 
  76.  
  77.  move.a #$11a,d1 
  78.  move.1 (d1),a 
  79.  bclr #0,a 
  80.  move.1 a,(d1)          ; clear IR detector bit 
  81.  
  82.  move.a #$11c,d0 
  83.  move.1 (d0),a 
  84.  bset #3,a 
  85.  move.b a,c 
  86.  bclr #3,c 
  87.  move.1 a,(d0)          ; turn IR emitter on 
  88.  
  89.  move.1 (d1),a          ; read IR detector 
  90.  move.1 c,(d0)          ; turn IR emitter off (it's only on for ~20us) 
  91.  
  92.  bbs #0,a,reflec 
  93.  
  94. noreflec 
  95.  move.a #"0",d1        ; return a "0" in the string 
  96.  exg.a d1,c 
  97.  bra.3 stostat 
  98.  
  99. reflec 
  100.  move.a #"1",d1      ; return a "1" in the string 
  101.  exg.a d1,c 
  102.  
  103. stostat 
  104.  push  
  105.  jsr restore_regs 
  106.  pop 
  107.  
  108.  move.a (d1),a         ; assuming a string on the top of the stack 
  109.  move.a a,d1 
  110.  add.a #$a,d1 
  111.  move.b c,(d1) 
  112.  
  113. exit 
  114.  jsr restore_regs 
  115.  move.a (d0),a 
  116.  add.a #5,d0 
  117.  jmp (a) 
  118.  
  119. pgmend 
  120.  rpl $0312b              ; SEMI 
  121.  
  122.  include class.sym 
  123.  
  124.  
  125. -------------------- Cut here. User RPL source follows. --------------- 
  126. @ Copyright 1992 Steven Ourada    Freeware 
  127.  
  128. @ 'Tricorder' simulator 
  129. @ Note that the assembly code must be inserted where shown for this program 
  130. @  to work properly. 
  131.  
  132. \<<  
  133.  "0" 
  134.  DO 
  135.   @  Assembly code inserted here 
  136.   IF DUP "1" SAME THEN 
  137.    200 .03 BEEP 
  138.   END 
  139.  UNTIL KEY 
  140.  END 
  141.  DROP DROP 
  142. \>> 
  143. --  
  144. ------- 
  145. Steven Ourada -- sourada@iastate.edu 
  146.